//缓存新消息通知
export default {
  state: {
    messageDate: []
  },
  mutations: {
    //接受消息存放
    messageDate(state, newVal) {
      state.messageDate = newVal;
    },
    //关闭消息/接受
    delMessageDate(state, newVal) {
      for (let i = 0; i < state.messageDate.length; i++) {
        if (JSON.stringify(newVal) == JSON.stringify(state.messageDate[i])) {
          state.messageDate.splice(i, 1);
          i--;
        }
      }
    }
  },
  actions: {
    commitMessageDate: (context, newVal) => {
      context.commit('messageDate', newVal);
    },
    delMessageDate: (context, newVal) => {
      context.commit('delMessageDate', newVal);
    }
  }
};
